package com.cqan.box.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cqan.entity.pk.LongEntity;

@Entity
@Table(name="TBL_BOX")
@SuppressWarnings("serial")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Box extends LongEntity {
	
	private String boxid;
	
	//厂家
	private String manufacturer;
	
	private Boolean state;
	
	private Date ctime;
	
	
	private List<AppBox> appBoxs;
	
	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "boxs",fetch = FetchType.LAZY)
	public List<AppBox> getAppBoxs() {
		return appBoxs;
	}

	public void setAppBoxs(List<AppBox> appBoxs) {
		this.appBoxs = appBoxs;
	}

	public Boolean getState() {
		return state;
	}

	public void setState(Boolean state) {
		this.state = state;
	}

	public Date getCtime() {
		return ctime;
	}

	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}

	public String getBoxid() {
		return boxid;
	}

	public void setBoxid(String boxid) {
		this.boxid = boxid;
	}

	public String getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}

	@Override
	public int hashCode() {
		
		return this.id.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Box) {
			Box box = (Box)obj;
			return this.id.equals(box.id);
		}
		return false;
	}
	
	
	

}
